<?php
/**
 * Created by PhpStorm.
 * User: asus
 * Date: 2017/9/29
 * Time: 16:44
 */

namespace Wechat\Controller;


class WebtaController extends CommonController
{
    //他人的主页
    public function index()
    {
        $openid = i('get.openid');
        $data = M('wechatuser')->where(['openid'=>$openid])->find();
        $this->assign('data',$data);
        $this->display();
    }
    //他的收藏
    public function tashoucang()
    {
        $this->display();
    }
    //他的发布
    public function fabu()
    {
        $this->display();
    }
    //他的发布-出租
    public function chuzu()
    {
        $openid = i('get.openid');
        $data = M('zhuanzulin')->where(['build'=>1,'openid'=>$openid])->order('time desc')->select();
        echo json_encode($data);
    }
    //他的发布-求组
    public function qiuzu()
    {
        $openid = i('get.openid');
        $data = M('zhuanzulin')->where(['build'=>2,'openid'=>$openid])->order('time desc')->select();
        echo json_encode($data);
    }
    //他的发布-新房
    public function xinfang()
    {
        $openid = i('get.openid');
        $data = M('zhuanxinfang')->where(['openid'=>$openid])->order('time desc')->select();
        echo json_encode($data);
    }
    //他的发布-求买
    public function qiumai()
    {
        $openid = i('get.openid');
        $data = M('zhuanershou')->where(['build'=>2,'openid'=>$openid])->order('time desc')->select();
        echo json_encode($data);
    }
    //他的发布-求买
    public function chushou()
    {
        $openid = i('get.openid');
        $data = M('zhuanershou')->where(['build'=>1,'openid'=>$openid])->order('time desc')->select();
        echo json_encode($data);
    }
    //他的发布-单位
    public function danwei()
    {
        $openid = i('get.openid');
        $data = M('zhuandanwei')->where(['openid'=>$openid])->order('time desc')->select();
        echo json_encode($data);
    }
    //他的发布-团队
    public function tuandui()
    {
        $openid = i('get.openid');
        $data = M('zhuanxiangmu')->where(['build'=>1,'openid'=>$openid])->order('time desc')->select();
        echo json_encode($data);
    }
    //他的发布-项目
    public function xiangmu()
    {
        $openid = i('get.openid');
        $data = M('zhuanxiangmu')->where(['build'=>2,'openid'=>$openid])->order('time desc')->select();
        echo json_encode($data);
    }
    //他的发布-其他发布
    public function qita()
    {
        $openid = i('get.openid');
        $data = M('zhuanqita')->where(['openid'=>$openid])->order('time desc')->select();
        echo json_encode($data);
    }
    //他的收藏所有
    public function shoucangta()
    {
        $openid = i('get.openid');
        $data = M('webshoucang')->where(['openid'=>$openid])->select();
        foreach ($data as $k => $v){
            $data[$k]['tid'] = M($v['model'])->where(['id'=>$v['tid']])->select();
        }
        echo json_encode($data);
    }
}